package com.zany.login.dao;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.zany.system.vo.UserInfoVO;
import com.zany.login.vo.UserResourceVO;

public class LoginDaoImpl extends SqlMapClientDaoSupport implements LoginDao{

	//登录
	public UserInfoVO login(UserInfoVO userInfo) {
		UserInfoVO userInfoVO = (UserInfoVO)this.getSqlMapClientTemplate().queryForObject("login.login", userInfo);
		return userInfoVO;
	}

	//获取功能菜单（主）
	public List<UserResourceVO> getTopMenu(UserInfoVO userInfo) {
		List<UserResourceVO> list = (List<UserResourceVO>)this.getSqlMapClientTemplate().queryForList("login.getTopMenu", userInfo);
		return list;
	}

	//获得功能菜单（子）
	public List<UserResourceVO> getMoreMenu(UserResourceVO userResourceVO) {
		List<UserResourceVO> list = (List<UserResourceVO>)this.getSqlMapClientTemplate().queryForList("login.getMoreMenu", userResourceVO);
		return list;
	}

	public void updateLastTime(UserInfoVO userInfo) {
		// TODO Auto-generated method stub
		this.getSqlMapClientTemplate().update("login.updateLastTime", userInfo);
	}

	public void updateThisTime(UserInfoVO userInfo) {
		// TODO Auto-generated method stub
		this.getSqlMapClientTemplate().update("login.updateThisTime", userInfo);
	}

	public List<UserResourceVO> getMoreMenuAdmin(UserResourceVO userResourceVO) {
		// TODO Auto-generated method stub
		return this.getSqlMapClientTemplate().queryForList("login.getMoreMenuAdmin", userResourceVO);
	}

	public List<UserResourceVO> getTopMenuAdmin() {
		// TODO Auto-generated method stub
		return this.getSqlMapClientTemplate().queryForList("login.getTopMenuAdmin");
	}

}
